<?php

namespace app\admin\model;

use app\common\model\TimeModel;

class Users extends TimeModel
{

    protected $name = "users";

    protected $pk = "uid";

    public function getGenderList()
    {
        return ['0'=>'女','1'=>'男',];
    }

    public function getStatusList()
    {
        return ['0'=>'正常','1'=>'离职',];
    }

    public function getBankList()
    {
        return [
            '1'=>'工商银行','2'=>'农业银行','3'=>'建设银行','4'=>'交通银行','5'=>'中国银行',
            '6'=>'招商银行','7'=>'邮政储蓄银行','8'=>'民生银行','9'=>'兴业银行',
        ];
    }

    public function getEntryDateAttr($value)
    {
        return date('Y-m-d', $value);
    }

    public function setEntryDateAttr($value)
    {
        return strtotime($value);
    }

    public function getJobNumberAttr($value) {
        return formatJobNumber($value);
    }

    public function sales()
    {
        return $this->hasMany(Sales::class,'uid','uid');
    }
}